Hello,
"advertise-peer-as" is a knob to provide backwards compatibility between RFC1771-compliant speakers and RFC4271-compiant speakers.
RFC 1771 section 9.1.3 https://tools.ietf.org/html/rfc1771 states:
For the benefit of future support of inter-AS multicast capabilities,
a BGP speaker that participates in inter-AS multicast routing shall
advertise a route it receives from one of its external peers and if
it installs it in its Loc-RIB, it shall advertise it back to the peer
from which the route was received. For a BGP speaker that does not
participate in inter-AS multicast routing such an advertisement is
optional.
The above text is not present in RFC4271. Hence, a RFC4271-compliant speaker shall use "advertise-peer-as" knob when talking to RFC1771-compliant speaker that expects own routes back.
As to what RFC1771-compliant speaker needs to do with own routes, is left out of the BGP spec and is therefore implementation-specific.
Finally, apart from the above purpose, using "advertise-peer-as" and "loops" is certainly possible but it is a complex way to do simple things when better tools are available such as "as-override".
HTH
Thx
Alex