Right after the Spanish-American War in 1898, the US acquired the Philippines from Spain. At that time, local leaders desired Philippines independence. The Philippines-American War was fought around 1901-1902 in which the US put down this quest for freedom and the Philippines was still US property at the time of the Pearl Harbor attack. However, if the US had granted the Philippines independence back in 1901, would Japan still have felt the need to go to war?
As mentioned in this Wikipedia article, Japan's reasons for attacking the US were mostly because of the US stopping oil and other material shipments to Japan and Japanese belief that further Japanese aggression in Asia (which they were intent on pursuing and not just or even primarily in Philippines) would lead to a war with the US anyway. Thus Japan attacked Pearl Harbor to gain the advantage of surprise.
So no, Philippine independence had nothing to do with Japan attacking Pearl Harbor and Japan would probably have gone to war anyway.
Japan did not attack the US because of the oil embargo. They went to war, in part, because of the oil embargo. But their most important territorial objective was the Dutch East Indies, with their oilfields.
The Japanese chose to attack the US, rather than just the European colonial powers, because the Philippines would have been a bone in their throat in the event that America intervened in a Japanese-Allied confrontation:
The Japanese reasoning (if you can call it that) for attacking the US still would still have held, if the independent Philippine government had not been reliably pro-Axis. A neutral Philipines probably would have gone the way of neutral Norway.
In 1942, the United States offered to accelerate the independence of the Philippines (scheduled for 1946) if Japan would stay out of this country, thereby "neutralizing" it. Japan did not accept.
There were two reasons why. First, the Philippines were a key "stop" on the way "south" (to the East Indies (modern Indonesia), and ultimately, Australia.
The second was that Japan was opposed to the presence of a U.S. fleet ANYWHERE in the Pacific. Neutralizing the Philippines wouldn't have resolved this issue. It would just have given Japan one less base from which to operate.
Hypotheticals belong to what is known as speculative history or allohistory, sometimes as alternate history.
To substantiate a hypothetical you need a theory of causation.
"However, if the US had granted the Philippines independence back in 1901, would Japan still have felt the need to go to war?"
This question asserts that the Empire of Japan went to war with the United States because of US control over the Philippines. Such a causal theory in actuality is demonstrably false. The immediate cause of the war was the presence of a culminating battle grand strategy in the Imperial Japanese Navy combined with the United States immediately hostile behaviour towards Japanese Imperialism in China and the colonies of France, The United Kingdom and Holland.
The intermediate cause of the war between Japan and the United States was competing imperial and neo-imperial interests, mainly voiced over the division of China's economy. Particularly due to the Showa racialist ideology in Japan and the export of Christian liberal-democratic ideology in the United States. (A world-systems / Marxist Imperialist analysis of cause, fairly solid at this level of analysis).
The final cause of the war was the Imperialist stage of capitalism, the development of neo-colonial economics in the United States involving loosely held colonies under nominal self-governance (or development to the same), and the racialist ideology of post-Restoration Japan and the increasing power of the networks of Trusts in the United States and their international imperial ambitions rooted in the Gilded Age.
So no, changing the formal nature of US control over the Philippines in 1901 would not change the conflict of interests between the emerging Showa racialist ideology and US liberalist neo-colonialism. However, it may "butterfly" the specifics of war between Japan and the United States, particularly if Japanese and US imperialist interests can be united against some other force in the area, particularly if the Trusts of the United States gain an interest in seeing Japanese control over China.